const { contextBridge, ipcRenderer } = require('electron')

contextBridge.exposeInMainWorld('task', {
	getPagedList(params, pageParams) {
		return ipcRenderer.invoke('task.getPagedList', params, pageParams)
	}
})

contextBridge.exposeInMainWorld('setting', {
	getList(key) {
		return ipcRenderer.invoke('setting.getList', key)
	},
	save(data) {
		return ipcRenderer.invoke('setting.save', data)
	},
	getByKey(key) {
		return ipcRenderer.invoke('setting.getByKey', key)
	}
})

contextBridge.exposeInMainWorld('asset', {
	getPagedList(params, pageParams, onlyWarning) {
		return ipcRenderer.invoke('asset.getPagedList', params, pageParams, onlyWarning)
	},
	getById(id) {
		return ipcRenderer.invoke('asset.getById', id)
	},
	save(data) {
		return ipcRenderer.invoke('asset.save', data)
	},
	deleteById(id) {
		return ipcRenderer.invoke('asset.deleteById', id)
	},
	saveBatch(data) {
		return ipcRenderer.invoke('asset.saveBatch', data)
	}
})
